package com.edu.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

@Data

@Document(indexName = "es-course", shards = 1,replicas = 0)
public class ESCourse {

    @Id
    private Integer classId; // spuId 也可以理解为class_id

    @Field(type = FieldType.Text, analyzer = "ik_max_word",store=true)
    private String className; //spunName 也可以理解为class_name

    @Field(type=FieldType.Date,index=true,store=true,format= DateFormat.basic_date_time)
    @JsonFormat( pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date signTime;  // 报名时间

    @Field(type=FieldType.Date,index=true,store=true,format= DateFormat.basic_date_time)
    @JsonFormat( pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date startTime; // 课程开始时间

    @Field(type=FieldType.Date,index=true,store=true,format= DateFormat.basic_date_time)
    @JsonFormat( pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date endTime; // 课程结束时间

    @Field(type=FieldType.Double,index=true,store=true)
    private Double money; //价格

    @Field(type=FieldType.Long,index=true,store=true)
    private Integer gradeId;                       // 年级Id

    @Field(type = FieldType.Keyword,index=true,store=true)
    private String gradeName;                   //年级名称 比如 初一

    @Field(type=FieldType.Long,index=true,store=true)
    private Integer subjectId;                        // 学科分类id
    @Field(type = FieldType.Keyword,index=true,store=true)
    private String subjectName;                    // 学科分类名称

//    @Field(type =FieldType.Long,index = true,store = true)
//    private Integer teacherId; //教师Id
//    @Field(type =FieldType.Keyword,index = true,store = true)
//    private String teacherName; //教师名称
//    @Field(type = FieldType.Keyword,index = false,store=true)
//    private String icon;       // 教师图片地址
////
    @Field(type = FieldType.Auto,index = true,store = true)
    private List<HfdTeacherInfo> teacherInfoList;

}
